Compensation system for electronic compass

ABSTRACT

An electronic compass is described for use in vehicles. The compass employs a magnetoresistive sensor for sensing the earth magnetic field and the sensor is operated in alternate set/reset bias modes. In a first embodiment, the compass is provided with deviation compensation by a closed loop system including measurement of the sensor output signals and an offset current strap for nullifying the vehicle deviation field. In a second embodiment, deviation compensation is provided by operation in an initial calibration mode and by operation in a normal compensation mode to adjust compensation, as needed, on a long term basis during normal operation of the compass. In the initial calibration mode, while the vehicle is being driven, the signal peak values are adjusted to a nominal earth field level by changing the offset current. Then, compensating signal reference values for each axis are determined as each peak for that axis is determined. The system automatically exits the initial calibration mode when certain criteria have been met. In the normal compensation mode, The signal reference value for each axis is adjusted at least once during the time interval between turn-on and turn-off of the vehicle ignition switch.

FIELD OF THE INVENTION

[0001] This invention relates to magnetic compasses for vehicles. Moreparticularly, it relates to compasses of the type which utilize anelectronic magnetic field sensor.

BACKGROUND OF THE INVENTION

[0002] Magnetic compasses are commonly used in vehicles, including landvehicles, boats and aircraft, as an aid in direction finding andnavigation. There is an increasing demand for magnetic compassesespecially for use in passenger cars. In this field of use, there is anincreasing requirement for a compass of low cost which exhibits arelatively high degree of accuracy with great reliability and which isof small size and weight.

[0003] Magnetic compasses for vehicles may be classified according tothe type of the magnetic field sensor. One type is a magnetic rotorsensor which utilizes a magnetized element rotatably mounted to alignitself with the ambient magnetic field. Examples of this type of vehiclecompass are disclosed in Schierbeek et al U.S. Pat. No. 4,862,594granted Sep. 5, 1989 and in co-pending application Ser. No. 07/597,854filed Oct. 15, 1990 by Schierbeek et al now U.S. Pat. No. 5,131,154,granted Jul.21, 1992. Said patents are assigned to the same assignee asthis application.

[0004] Another type is a flux gate sensor which utilizes a saturablemagnetic core with excitation and sense windings for sensing thedirection and field strength of an ambient magnetic field. Examples ofvehicle compasses with flux gate sensors are represented by Baker et alU.S. Pat. No. 3,683,668 granted Aug. 15, 1972; Bower et al U.S. Pat. No.4,733,179 granted Mar. 22, 1988; Hormel U.S. Pat. No. 4,720,992 grantedJan. 26, 1988; and Van Lente et al U.S. Pat. No. 4,953,305 granted Sep.4, 1990.

[0005] There is a need, especially in vehicle compasses for passengercars, for an improved magnetic field sensor to achieve the goals ofaccuracy, reliability, small size and weight and low cost. However, oneof the problems in meeting these goals is that of providing deviationcompensation for the compass, which is required to provide a high degreeof accuracy, without a large cost penalty. It is known that a magneticcompass installed in a vehicle must be calibrated in the vehicle toaccount for the disturbing effect of the vehicle magnetic field. It isknown that vehicles produce a magnetic field due to the presence offerromagnetic materials, electric current carrying wires and the likeand this magnetic field interferes with the earth field at locationswithin and adjacent the body of the vehicle. The magnetic field sensorof a compass responds to the localized magnetic field in which it isimmersed for the purpose of direction finding with reference to theearth magnetic field. The magnetic field vector produced by the vehicle,herein referred to as the deviating magnetic field vector, combines withthe earth magnetic field vector to produce a resultant or externalmagnetic field vector which, without calibration or compensation isunsuitable for reliable and accurate direction finding. Fully automaticdeviation compensation is needed to meet present-day demands forpassenger cars.

[0006] It is known to provide deviation compensation in a magneticcompass with a rotor type sensor by use of a pair of compensation coilswhich are energized with current to generate a magnetic field which isequal and opposite to the deviating magnetic field. This method ofdeviation compensation requires the vehicle to be oriented in certaincardinal directions relative to magnetic north and adjustments of coilcurrent must be made. This adjustment may be carried out by the vehicledriver or it may be automated in a computer controlled compass. Itresults in inaccuracy unless the vehicle heading is accurately alignedrelative to magnetic north. Deviation compensation of this type isdisclosed in the above cited Schierbeek U.S. Pat. No. 4,862,594.

[0007] Another method of deviation compensation for vehicle compasses isreferred to as the one hundred eighty degree compensation method. Inthis, the resultant magnetic field is measured with the vehicle in anyselected orientation relative to the magnetic north and then theresultant field is measured with the vehicle in an orientation displacedone hundred eighty degrees from the first orientation. Using themeasured values of the magnitude and directions of the resultant fields,the deviating field is calculated for both magnitude and direction. Thecalculated value is stored and subtracted from the magnetic fieldmeasurements subsequently taken by the compass in use for directionfinding to thereby compensate it for deviation. The use of this methodfor a flux gate compass is disclosed in the above cited Bower U.S. Pat.No. 4,733,179, the Hormel U.S. Pat. No. 4,720,992 and the Baker et alU.S. Pat. No. 3,683,668.

[0008] Fully automatic deviation compensation systems for vehiclecompasses have been proposed wherein no manual intervention is required.In the Tsushimo U.S. Pat. No. 4,445,279, granted May 1, 1984 anautomatic system is disclosed using a flux gate sensor. An A-to-Dconverter and microprocessor are used to calculate an offset correctionto compensate for the deviating field of the vehicle after driving thecar in a full circle. A fully automatic compensation system is describedin the Al-Attar U.S. Pat. No. 4,807,462 granted Feb. 28, 1989. In thesystem of this patent, a flux gate sensor measures three headings withthe car moving, and using the headings, the coordinates are derived forthe center of the earth field circle and the directional offset valuesare computed by using the coordinates. Another fully automatic deviationcompensation system is described in the Van Lente U.S. Pat. No.4,953,305 cited above. In this system, a flux gate sensor is used andthe maximum and minimum signal values are recorded while the vehicle isdriven through a closed loop. Then, the value of the deviating vehiclefield is calculated from the recorded values. The compensating currentis applied to the respective X and Y axis sense coils of the flux gatesensor to nullify the deviating field.

[0009] In the prior art, it is proposed to use magnetoresistive sensorsin magnetic compasses. Such a compass is shown in the Picard U.S. Pat.No. 1,946,170 granted Feb. 13, 1934 wherein the magnetoresistiveelements are connected in a bridge circuit. A compass using thin filmmagnetoresistive sensors is described in the Stucki et al U.S. Pat. No.3,942,258 granted Mar. 9, 1976. In this system three magnetoresistivesensors are disposed in orthogonal relationship to develop a signalcorresponding to the angular relationship between the compass platformand the magnetic north. The sensors are provided with a pumping coil andan output coil wound around the film at ninety degrees to each other.The pumping coil applies an alternating bias magnetic field to themagnetoresistive film. The Sansom U.S. Pat. No. 4,525,671 granted Jun.25, 1985 describes a magnetoresistive sensor with a singlemagnetoresistive element capable of sensing two components of a magneticfield. A current strap extends parallel to the magnetoresistive elementand other current strap extends at right angles to the magnetoresistiveelement. One of the current straps carries current in alternatedirections during a periodic cycle while the other strap carries currentin a single direction. Another magnetic compass comprising amagnetoresistive thin film is disclosed in UK patent application 8707218published Sep. 28, 1988. Two pairs of magnetoresistive thin films arearranged at right angles to each other. Means are provided to produce abiasing magnetic field and to measure a change in electric resistivityof the magnetoresistive material. The Boord et al U.S. Pat. No.4,533,872 granted Aug. 6, 1985 describes a magnetoresistive thin filmsensor of particular configuration for use as an electronic sensor in acompass.

[0010] As indicated above, the prior art is replete with vehicle compasstechnology in great detail. While the use of magnetoresistive sensorsfor compasses is suggested in the prior art, practical applicationrequires an acceptable technique for fully automatic deviationcompensation in a vehicle. Even though the prior art includes manydifferent methods of deviation compensation for vehicle compasses, theart is lacking in respect to deviation compensation for magnetoresistivesensors.

[0011] A general object of this invention is to provide an improvedvehicle compass using a magnetoresistive sensor which overcomes certaindisadvantages of the prior art.

SUMMARY OF THE INVENTION

[0012] In accordance with this invention, a vehicle compass is providedwhich provides a high degree of accuracy and reliability with small sizeand weight and which is of low cost. This is accomplished using a thinfilm magnetoresistive sensor provided with a current conductor forproviding switchable magnetic bias and a current conductor fornullifying a deviating field.

[0013] Further, in accordance with a first embodiment of this invention,an electronic compass is provided which employs a closed loop system tonullify deviating magnetic fields.

[0014] Further, in accordance with a second embodiment of thisinvention, an electronic compass is provided which automaticallyoperates in an initial calibration mode to determine the initialcompensation for the particular vehicle installation and in a normalcalibration mode which is operative during normal compass operation foradjusting calibration as may be needed. In the initial calibration mode,the signal peak values are adjusted to a nominal earth field level bychanging the offset current. compensating signal reference values foreach axis are determined as each peak for that axis is determined. Inthe normal compensation mode, the sensor signals are sampled and storedduring compass operation in its direction indicating mode. When a newpeak is acquired for one axis, which should occur at the signalreference value in the orthogonal axis, an adjustment value is storedand later used to adjust the compensating signal reference value. Thesignal reference value for each axis is adjusted at least once for eachpeak of the orthogonal axis during the time interval between turn-on andturn-off of the vehicle ignition switch.

[0015] A complete understanding of this invention may be obtained fromthe detailed description that follows taken with the accompanyingdrawings.

DESCRIPTION OF TEE DRAWINGS

[0016]FIG. 1 depicts a single-axis magnetoresistive sensor;

[0017]FIG. 2 is a graphical representation of the operation of asingle-axis magnetoresistive sensor;

[0018]FIG. 3 is a diagram representing a typical relationship of thecompass sensor and certain magnetic field vectors with the directionalaxis of a vehicle in which the compass of this invention is installed;

[0019]FIG. 4 is a block diagram of a compass embodying this invention;

[0020]FIGS. 5A and 5B are a graphical representation of the operation ofthe compass of FIG. 4;

[0021]FIG. 6 is a timing diagram to aid in explanation;

[0022]FIG. 7 is a flow chart representing the program executed by themicrocomputer of the compass;

[0023]FIG. 8 is a schematic diagram of the Y-axis signal channel of thecompass embodying this invention;

[0024]FIG. 9 is a schematic diagram of the X-axis signal channel;

[0025]FIGS. 10A and 10B taken together form a schematic diagram ofelectronic circuits, including the microcomputer, which are coupled withthe circuits of FIGS. 8 and 9 of the compass;

[0026]FIG. 11 is a schematic diagram of the bias current circuit for setand reset of the sensor; and

[0027]FIGS. 12A and 12B taken together constitute a schematic circuit ofthe electronic compass of a second embodiment of this invention;

[0028]FIG. 13 is a modification of the electronic circuit;

[0029]FIGS. 14A and 14B taken together constitute a flow chartrepresenting the main loop of the control program executed by themicrocomputer;

[0030]FIGS. 15A and 15B taken together constitute a flow chartrepresenting a program executed by the microcomputer for the initialcalibration mode of operation;

[0031]FIG. 16 is a flow chart representing the program executed by themicrocomputer for the normal calibration mode of operation;

[0032]FIG. 17 is a graph showing examples of sensor offset;

[0033]FIG. 18 is a flow chart representing a program executed by themicrocomputer for calculating sensor offset;

[0034]FIG. 19 is a side elevation view of a vehicle inside the rearviewmirror having the compass of this invention installed therein;

[0035]FIG. 20 is a front elevation view of an inside rearview mirrorshowing a compass display above the mirror;

[0036]FIG. 21 is a front elevation view of another inside rearviewmirror with the compass display behind the mirror;

[0037]FIG. 22A is a front elevation view of an inside rearview mirrorwith an integrated compass module mounted on the mirror support bracket;and

[0038]FIG. 22B is side elevation view of the mirror and compass of FIG.22A.

BEST MODE FOR CARRYING OUT THE INVENTION

[0039] Referring now to the drawings, there is shown an illustrativeembodiment of the invention in a magnetic compass for vehicles whichutilizes a magnetoresistive sensor. It will be appreciated as thedescription proceeds that the invention is useful in other applicationsand may be realized in different embodiments.

FIRST EMBODIMENT OF THE INVENTION

[0040] Magnetoresistive Sensor

[0041] Before describing the compass of this invention, it will behelpful to consider the magnetoresistive sensor used in the compass. Asingle-axis magnetoresistive sensor is illustrated schematically inFIG. 1. The sensor 10 comprises a bridge circuit 12 including a set offour magnetoresistive elements 14 connected in the bridge circuit. Themagnetoresistive elements 14 are formed of a magnetic material whichexhibits the magnetoresistive effect, such as permalloy, which changesits resistivity in the presence of an external magnetic field. Thebridge circuit 12 is excited with a DC voltage across the inputterminals and an output signal voltage V₀ is developed across the outputterminals in response to an external magnetic field. The sensor 10 isprovided with a bias current strap 16 which is energized by a set/resetvoltage at its input terminal to produce a magnetic bias field M_(B)which is of reversible polarity in accordance with the input voltage.Also, the sensor 10 is provided with an offset current strap 18 which isenergized by a reversible polarity offset voltage applied to its inputterminals. The current strap 18 produces an offset magnetic field MOwhich is reversible polarity in accordance with the input signalvoltage. The functions of the bias current strap 16 and the offsetcurrent strap 18 will be discussed subsequently.

[0042] Preferably, the sensor 10 is fabricated on a silicon substrate onwhich the magnetoresistive elements 14 are deposited as a thin film. Inthis construction, the bias current strap 16 is formed as a currentconductive layer. It overlays a soft magnetic layer which in turnoverlays the elements 14. A pulse of current in one direction throughthe current strap 16 produces a magnetic field of sufficient strength tosaturate the magnetic layer and provide a positive bias field. When thecurrent is removed, the device remains in a biased condition under theinfluence of the magnetic layer. Similarly, a pulse of current in theopposite direction provides a negative bias. The offset current strap 18is formed as a current conductive layer which overlays themagnetoresistive elements 14 and carries current in a directionperpendicular to the current carrying direction of the strap 16. Theoffset magnetic field MO produced by the current strap 18 is effectiveto oppose an external magnetic field to which the magnetoresistiveelements 14 are subjected. Magnetoresistive sensors constructed by thedeposition of a thin film ferromagnetic material on a silicon substrateare well-known in the art, as indicated by the Boord U.S. Pat. No.4,533,872.

[0043] The operation of the sensor 10 will be described with referenceto the graph of FIG. 2. The curve V represents the output voltage of thesensor 10 as a function of magnetic field strength in a directionperpendicular to the current flow in the magnetoresistive elements 14.When the field strength is zero, the output voltage V has a maximumvalue and as the field strength is increased from zero in eitherdirection, the output voltage decreases symmetrically. (The terms‘positive’ and ‘negative’ and the symbols therefor are used in arelative sense to denote opposite directions or polarity ofmagnetization.) The voltage curve near the peak is highly non-linear andtends to become substantially linear in a mid-range of the voltagevariation. In order to obtain directional information regarding anexternal magnetic field, a bias field having a field strengthalternating between +M_(B) and −M_(B) is applied to the magnetoresistiveelements 14. This is accomplished by the bias current strap 16 and theassociated soft magnetic layer which is alternately driven into magneticsaturation by current pulses of alternate polarity through the currentstrap 16. When a current pulse is applied in one direction the devicewill operate with a positive bias, +M_(B), which herein is called the“set model” until the saturation of the soft iron magnetic layer isreversed. A current pulse in the opposite direction will reverse thedirection of saturation and the device will operate with a negativebias, −M_(B), herein called the “reset mode”.

[0044] When the device is operated in the alternating set/reset modesand when subjected to zero field strength, the output voltage V willhave a value V_(R) in the set mode and also in the reset mode so thatthe output voltage remains constant at the V_(R) level. When the sensor10 is subjected to an external magnetic field M_(e), the external fieldis combined with the bias field M_(B). As shown in FIG. 2, if theexternal field is of positive polarity, i.e. +M_(e), it will add to thebias field +M_(B) to produce a resultant field strength M_(B)+M_(e)which results in an output voltage −V_(e). In the reset mode, theexternal field +M_(e) decreases the bias field −M_(B) to produce a netfield strength of −M_(B)+M_(e). This produces an output voltage in thereset mode of +V_(e). Thus, the output voltage of the sensor 10, whensubjected to an external magnetic field of +M_(e), is an alternatingsquare wave voltage of the same frequency as the alternating square wavevoltage applied to the bias current strap 16. The output voltage variesfrom a positive peak value of +V_(e) in the reset mode to a negativepeak value of −V_(e) in the set mode. As indicated in FIG. 2, thepeak-to-peak value of the output voltage V₀ represents the externalfield M_(e). As will be discussed subsequently, the voltage V_(R) is anoffset voltage which is removed from the output voltage V₀ by ACcoupling. It is noted further that if the output voltage V₀ is positivein the reset mode, the external field M_(e) is positive and if theoutput voltage V₀ is positive in the set mode the external field isnegative. It is only necessary to measure the positive portion of theoutput voltage V₀ to determine the magnitude of the external field andthe direction of the external field M_(e) will be known from itspolarity and whether it is in the set or reset mode.

[0045] Vehicle Compass System

[0046] Now consider the sensor 10 installed in a vehicle 26, such as apassenger car, as depicted in FIG. 3. In order to determine thedirection of the external field M_(e), it is necessary to use twosingle-axis sensors 10 and 10′ which are orthogonally oriented relativeto each other. The sensor 10 is mounted in the vehicle with itssensitive axis SA parallel to the direction reference axis, i.e. thelongitudinal axis Y-Y of the vehicle 26. The sensor 10′ is of the sameconstruction as sensor 10 and is mounted adjacent the sensor 10 with itssensitive axis extending parallel to the X-X axis of the vehicle. Insuch an installation, the sensors are subject to the earth magneticfield M_(N) which is stationary with reference to the earth and it isalso subjected to the vehicle magnetic field M_(v) which is stationarywith respect to the vehicle. The external field M_(e) to which thesensor 10 is subjected is the vector sum of the earth field and thevehicle field. Accordingly, the sensor 10 responds to the Y-axiscomponent of the vehicle field and the sensor 10′ responds to the X-axiscomponent. The vehicle field M_(V) remains constant regardless of thedirection heading of the vehicle 26. However, the external magneticfield Me includes a component due to the earth field M_(N) and theoutput voltages of the sensors 10 and 10′ vary with vehicle headingrelative to the magnetic north direction, as will be discussed below.

[0047] The electronic compass of this invention is shown in blockdiagram in FIG. 4. In general, the compass comprises a two-axis sensor32 and a multiplexer 34 which are mounted on a sensor circuit board 36.A mother board 46 mounts a microcomputer 38, an analog-to-digitalconverter 42 and a digital-to-analog converter 44 which controls aconstant current source 48. The circuits of FIG. 4 are operative tomeasure the X and Y-axis output signals and to process the signals toeliminate the DC voltage offset and to nullify the effect of the vehicledeviating magnetic field to obtain deviation compensation of thecompass. The microcomputer 38 is operated under a control program toprocess the signals to achieve deviation compensation and to compute themagnetic heading of the vehicle, as will be described subsequently.

[0048] The circuit of FIG. 4 will now be described in greater detail.The two-axis sensor 32 comprises the Y-axis sensor 10 and the X-axissensor 10′ mounted with respect to each other and the vehicle 26 asdescribed above. The microcomputer 38 controls the switching of a sensorbias circuit 60 to bias the sensors alternately in the set and resetmodes. A multiplexer 34 has an address select input 52 for selecting Xor Y-axis output signals. The output signal of the Y-axis sensor 10 isapplied to an input 56 of the multiplexer and the X-axis output signalof the sensor 10′ is applied to an input 54 of the multiplexer. Theoutput signal of the multiplexer at output 58 is coupled through acapacitor 62 to the input 64 of the A/D converter 42. The capacitor 62provides AC coupling between the multiplexer output 58 and the A/Dconverter input 64 to block the DC offset voltage V_(R) discussed abovewith reference to FIG. 2. Thus, the amplitude of the output voltages ofthe sensors 10 and 10′ which must be measured by the A/D converter 42 isreduced by the value of the DC offset voltage.

[0049] The output of the A/D converter 42 is applied to inputs 63 of themicrocomputer 38. The microcomputer 38 processes the digital signaloutputs of the A/D converter 42 in accordance with an algorithm fordetermining the nullifying magnetic field for the respective X-axis andY-axis sensors 10′ and 10 to offset and nullify the effect of thedeviating vehicle magnetic field on the sensors. This algorithm isembodied in the program (see FIG. 7) of the microcomputer 38 which willbe described subsequently.

[0050] Deviation Compensation

[0051] The manner in which the compass is compensated for deviation dueto the vehicle magnetic field will be described, in general, withreference to FIGS. 5A and 5B. With the compass represented in FIG. 4installed in the vehicle 26, as described with reference to FIG. 3, theoutput signal of the sensor 10 as it is applied through AC coupling tothe input of the A/D converter 42 is represented by the waveform V_(ey)in FIG. 5A. This signal V_(ey) has an offset component D_(y), prior todeviation compensation, which is of constant value and produced by theY-axis component of the vehicle field. The Y-axis output signal V_(ey)has an alternating component E_(y) which is produced by the earthmagnetic field in accordance with the direction heading of the vehicle26. The component E_(y) varies in a sinusoidal manner as shown in FIG.5A relative to the signal level D_(y) as the vehicle is driven throughvarious directions relative to magnetic north. The waveform V_(ey) ofthe Y-axis output signal may be produced over a relatively short timeperiod or a long time period; it is depicted in FIG. 5A without regardto time. The output signal, instead, is plotted as a function of vehicledirection. When the vehicle is headed in the direction of magneticnorth, the output signal V_(ey) is at its maximum value V_(eymax) whenit is headed in the magnetic south direction it is at a minimum value,V_(eymin). When the heading is either west or east, the value of theY-axis signal V_(ey) is at the value of the deviation component D_(y)which is half way between the maximum and minimum values.

[0052] It is required to determine the, current in the deviation offsetstrap 18 for nullifying the Y-axis component of the deviating magneticfield. For this purpose, the A/D converter 42 is set with a full-scalerange of reading capability which is equal to or slightly greater thanthe maximum value of the earth field component E_(y) which occurs withinthe geographical range, such as the North American continent, in whichthe vehicle may be operated. This full scale range of the A/D converter42 is represented by the signal voltage level designated A/D in FIG. 5A.The operation of the compass circuit to achieve the deviation offsetcurrent in strap 18 of the sensor 10 will be described subsequently.

[0053] In a manner analogous to that described above for the Y-axisoutput signal of sensor 10, with reference FIG. 5A, the X-axis sensor10′ produces an X-axis output signal V_(ex)as depicted in FIG. 5B. It isnoted that this signal V_(ex) has a component D_(x) which is constant asa result of the X-axis component of the deviating vehicle field. It alsohas an alternating component E_(X) due to the earth field which variesin accordance with the direction heading of the vehicle. However, thealternating component, while varying in a sinusoidal manner, is ninetydegrees out-of-phase with the variable component E_(y) in the outputsignal of the Y-axis sensor 10. It is noted that the deviation componentD_(X) of the output signal V_(ex) of the X-axis sensor lot is typicallydifferent in magnitude from the deviation component D_(y) of the outputsignal V_(ey) of the Y-axis sensor 10; the relative magnitudes dependupon the direction of the vehicle magnetic field vector M_(v) and theyare equal to each other only when the vector is at forty-five degrees oran odd multiple thereof relative to the longitudinal axis of thevehicle. On the other hand, the alternating component E_(X) in theX-axis sensor output signal Vex has the same amplitude as thealternating component E_(y) in the output signal V_(EY) of the Y-axissensor 10. As indicated in FIG. 5B, the full scale range of the A/Dconverter 42, designated by the signal level A/D, is the same for thesampling of both the Y-axis and X-axis output signals by the A/Dconverter 42.

[0054] Compass Operation

[0055] The operation of the electronic compass will now be describedwith reference to FIGS. 4, 5A, 5B, 6 and 7. An accurate determination ofthe vehicle magnetic heading can be made only if the influence of thedeviating magnetic field of the vehicle is nullified. When suchnullification is achieved, the Y-axis and X-axis output signalscorrespond only to the components of the earth magnetic field and can becombined in a known functional relationship to determine the directionof the magnetic north vector. The operation of the magnetic compass forachieving nullification of the deviating magnetic field, for deviationcompensation of the compass, will now be described.

[0056] A timing diagram depicting the operation for nullification of thedeviating vehicle magnetic field and measurement of the earth magneticfield is shown in FIG. 6. The sensors 10 and 10′ are alternatelyoperated in the set mode and the reset mode simultaneously with eachother under timing control signals from the microcomputer 38. Inparticular, the bias current straps 16 and 16′ of sensors 10 and 10′,respectively, are connected in series and are energized with the samecurrent pulse in the reset direction for a reset period, say fivemilliseconds, and are energized with the same current pulse in the setdirection for a set period, say five milliseconds. During the resetmode, as indicated in FIG. 6, the output signal of the X-axis sensor 10′is measured by the A/D converter 42. Initially, as indicated in FIG. 5Bthe amplitude of the output signal V_(ex) is greater than the full scaleof the A/D converter. As a result of such measurement, the microcomputer38 produces an output signal to the D/A converter 44 which causes it toproduce an increment of deviation offset current having a polarity, inthe deviation offset current strap 18′ of the sensor 10′, such that itnullifies an increment of the X-axis component of the vehicle deviatingfield. Further, as shown in FIG. 6, during the set mode, the outputsignal of the Y-axis sensor 10 is measured by the A/D converter 42.Initially, as indicated in FIG. 5A, the value of the output signalV_(ey) will be greater than the full scale of the A/D converter. As aresult of this measurement, the microcomputer 38 will provide a controlsignal to the D/A converter 44 which causes the current source 48 toproduce an increment of deviation offset current in the offset currentstrap 18 of the Y-axis sensor 10 with a polarity such that it nullifiesan increment of the Y-axis component of the vehicle deviating field.Next, as indicated in FIG. 6, the output signal of the Y-axis sensor 10is measured during the reset cycle. Following that, the output signal ofthe X-axis sensor 10′ is measured during the set mode and then it ismeasured during the reset mode. For each output signal measurement whichdetermines that the signal magnitude is greater than the full scale ofthe A/D converter 42, the current in the corresponding deviation offsetcurrent strap 18 or 18′ is incrementally increased. This processcontinues until the deviation offset current in the current strap 18 ofthe Y-axis sensor is at a level within the full scale of the A/Dconverter 42 which is of such value that the Y-axis component of thevehicle deviating field is substantially nullified. The same is donewith respect to the X-axis sensor. In this condition, the values of theY-axis output signal and the X-axis output signal correspond accuratelyto the earth magnetic field for the particular vehicle headings duringwhich measurements are made. The deviation compensation process iscontinuous during vehicle operation; the first cycle of compensation iscompleted when the vehicle has turned through a full circle from anyarbitrary starting point. Turning of a full circle is indicated by theoccurrence of the peak values V_(eymax) and V_(eymin) corresponding tothe maximum and minimum output signals of the Y-axis sensor and theoccurrence of V_(exmax) and V_(exmin) corresponding to the maximum andminimum values of the output signals of the X-axis sensor.

[0057]FIG. 7 is a flow chart representing the program of themicrocomputer 38. At block 100, the execution of the program is startedand it proceeds to block 102 which reads the output signal of the X-axissensor 10′. In block 104 the program determines whether the value of theX-axis signal is within the full scale range of the A/D converter 42. Ifit is not, the program advances to block 106 which determines whetherthe value of X is greater than the full scale of the A/D converter 42.If it is, block 108 increases the nullifying field in the -X directionand the program loops back to block 102. If block 106 determines that Xis not greater than the full scale, block 112 increases the nullifyingfield in the +X direction and the program loops back to block 102.

[0058] If at block 104 it is determined that the measured value ofX-axis output signal is within the full scale range of the A/D converter42, the program advances to block 144 which reads the measurement of theoutput signal of the Y-axis sensor 10. Then, block 116 determineswhether the value of the Y-axis signal is within the full scale range ofthe A/D converter 42. If it is not, block 118 determines whether thevalue is greater than the full scale range. If it is, block 122increases the nullifying field in the Y-axis sensor 10 in the -Ydirection. Then, the program loops back to block 102. If at block 118 itis determined that the output signal of the Y-axis sensor is not greaterthan the full scale range of the A/D converter, block 124 increases thenullifying field of the Y-axis sensor in the +Y direction and theprogram loops back to block 102. This program execution is continueduntil at block 104 it is determined that the X-axis output signal iswithin the full scale range of the A/D converter 42 and further it isdetermined at block 116 that the output signal of the Y-axis sensor iswithin the full scale range. Then, the program advances to block 126which determines whether the maximum value or positive peak of theoutput signal of the X-axis sensor 10′ has been identified. If it hasnot, the program loops back to block 102. If it has, the programadvances to block 128 which determines whether the minimum value ornegative peak of the output signal of the X-axis sensor has beenidentified. If it has not, the program loops back to block 102; if ithas, the program advances to block 132. Block 132 determines whether themaximum value or positive peak of the output signal of the Y-axis sensorhas been identified. If it has not, the program loops back to block 102.If it has, the program advances to block 134. Block 134 determineswhether the minimum value or negative peak of the output signal of theY-axis sensor has been identified. If not, the program loops back toblock 102. If it has, it is determined that the deviation compensationprocedure has completed a full cycle.

[0059] In this state, the X-axis and Y-axis output signals correspondsubstantially to the earth magnetic field and are suitable for computingthe magnetic heading of the vehicle. It will be understood that theprocess described is repeated continuously and adjusts the deviationcompensation in accordance with changes in the vehicle magnetic fieldthat may occur and to continually enhance the accuracy of the headingindication. When the block 134 determines that a full cycle of deviationcompensation has been executed, the program advances to block 136 whichcomputes the magnetic heading of the vehicle. Then, block 138 adds astored value of variation compensation to obtain the true heading of thevehicle. The true heading is displayed for the information of thevehicle driver by block 142.

[0060] Electronic Circuit of the Compass

[0061] The circuit of the electronic compass is shown in the schematicdiagrams of FIGS. 8, 9, 10A, 10B and 11. FIG. 8 shows the Y-axis signalchannel 70Y for developing the output signal V_(ey) from the outputsensor 10. The bridge circuit of the sensor 10 is excited with a D/Cvoltage V_(cc). The output of the bridge circuit is supplied to theinput of a first stage amplifier 204 which provides a voltage gain ofabout ten or twelve. The amplified output is applied through an ACcoupling capacitor 206 to the input of a second stage amplifier 208which provides a gain of about twenty. The output of the amplifier 208is applied through an AC coupling capacitor 212 to a terminal 214 forapplication of the signal V_(ey) to the circuit shown in FIG. 10A whichwill be described presently.

[0062] The X-axis channel 70X for developing the output signal V_(ex)from the output sensor 10′ is shown in FIG. 9 and is similar to that ofFIG. 8. The bridge circuit of the sensor 10′ is excited with the DCvoltage V_(cc). The output of the bridge circuit is supplied to theinput of a first stage amplifier 224 which provides a voltage gain ofabout ten or twelve. The amplified output is applied through an ACcoupling capacitor 226 to the input of a second stage amplifier 228which provides a gain of about twenty. The output of the amplifier 228is applied through an AC coupling capacitor 232 to a terminal 234 forapplication of the signal V_(ex) to the circuit shown in FIG. 10A whichwill be described presently.

[0063]FIGS. 10A and 10B taken together form a schematic diagram of theelectronic circuits, including the microcomputer 38, which are coupledwith the circuits of FIGS. 8 and 9 described above and the circuit ofFIG. 11 which will be described below. The microcomputer 38 is, in theillustrative example, an eight bit microprocessor type COP881C isavailable from National SemiConductor, Inc. of Palo Alto, Calif. Asshown in FIG. 10A, the microcomputer 38 is provided with a reset circuit72 of conventional design coupled with the pins V_(cc), Reset and Groundas indicated. The microcomputer is also provided with a clock circuit70, also of conventional design, and connected with the pins CK1 andCK0. As shown in FIG. 10B, the microcomputer 38 is coupled with anEEPROM 246 at pins G1, G5, G4, G6. The EEPROM 246 serves as a permanentmemory for data to be stored when the power to the electronic circuit isinterrupted. A compass heading display 76, such as a vacuum fluorescentdisplay, is coupled to pins G5, G4 and G6. The display may be located inthe vehicle at any location convenient for the driver remotely, ifdesired, from the location of the mother board 46. Referring again toFIG. 10A, a manual switching circuit 252 is coupled with microcomputerpins 10, 11, 12 and 13. A manual switch 254 is provided for use inconnection with compensating the compass for variation. Also, a manualswitch 255 is shown for changing the brightness of the display 248 butautomatic means could be provided. The remaining circuits associatedwith the microcomputer 38, which will be described presently, areoperative to control the sensors 10 and 10′ and to process the outputsignals thereof to provide deviation compensation and to develop theheading direction signals. The heading is presented in alphanumeric formon the display 248 to indicate the cardinal and intercardinal compasspoints heading to the vehicle driver.

[0064] A driver circuit 282 for the set/reset current straps 16 and 16′of the sensors 10 and 10′ is shown in FIG. 11. The switching signal forthe driver circuit 282 is produced by the microcomputer 38 at output pinDo and applied to the input terminal 284. The driver circuit 282comprises a pair of Darlington transistors 286 and 288 which arealternately switched conductive and non-conductive in response to theswitching signal on connector 284. Accordingly, the current straps 16and 16′ are energized with current pulses as shown in the timing diagramof FIG. 6 and described above to provide the set and reset modes for thesensors 10 and 10′ for the measurement of the Y-axis sensor outputsignal and X-axis sensor output signal, respectively.

[0065] As shown in FIG. 10A, the multiplexer 52 receives the Y-axissensor output signal at terminal 214 and receives the X-axis sensoroutput signal at terminal 234. The multiplexer 34 is provided with anaddress signal from the data output pins D1 and D2 of the microcomputer38 which is applied to pins A and B of the multiplexer 52. Thus, outputsignals of the Y-axis and X-axis sensors 10 and 10′ are accessedalternately in timed relation with the set and reset modes as describedwith reference to FIG. 6. The sensor output signals are alternatelyoutputted through pin 0/1 of the multiplexer to the A/D converter 42shown in FIG. 10A. The A/D converter includes a comparator 256 which hasits inverting input connected with the 0/1 output pin of the multiplexer52. The non-inverting input of the comparator 256 is connected with theoutput of a ramp generator 258 which receives a pulsed input from pin D3of the microcomputer 34. A clamp circuit 262 is coupled with the rampgenerator 258 and clamps the ramp generator output at a certain voltagelevel so that the output does not go all the way to ground after eachramp which would require a time delay on build-up to the ramp referencevoltage. The comparator 256 is operated with a reference voltage, forexample, of about 2.5 volts on the non-inverting input. The A/Dconverter has a full scale range of 2.0 volts above the reference and,for example, the clamp voltage is about 2.3 volts. The ramp voltage isincremented at the rate of one millivolt per microsecond and the pulsecount required to reach the signal voltage level at comparator 256 isstored in a register and represents the measured value of the sensorvoltage applied to the A/D converter at comparator 256. The pulse countregister indicates when the signal measurement is greater than the fullscale range of the A/D converter 42.

[0066] As shown in FIG. 10B, the D/A converter 44 is coupled with outputpins L0 through L7. The D/A converter 44 is a ladder network known as anR2R network and, for example, develops an output voltage of 2.5 volts ata register count of 127. The output of the D/A converter is appliedthrough a voltage-to-current converter comprising amplifiers 262 and266. The current amplifier 266 develops the offset current supply atconnector 268 for the offset current straps 18 and 181 which are shownin FIG. 10A. The offset current return circuit 272 of FIG. 10A comprisesan amplifier 274 which has its non-inverting input coupled with pin 2 ofthe multiplexer 52. The output of the amplifier 274 provides the offsetcurrent return at the terminal 276. The operation of the A/D converter42 and the D/A converter 44 for developing the offset current requiredto provide deviation compensation is described above with reference toFIGS. 5A and SB.

SECOND EMBODIMENT OF THE INVENTION

[0067] A second embodiment of the invention will now be described withreference to FIGS. 12 through 22. The second embodiment providesdeviation compensation of the compass to a high degree of accuracy on along term basis. This is accomplished by operation in an initialcalibration mode followed by operation in a long term or normalcalibration mode.

[0068] In initial calibration mode, the sensor output signals for eachaxis are alternately adjusted until they are within the full scale orreadable range of the A/D converter. This is done by changing the offsetcurrent for each sensor by relatively large increments, if necessary, toproduce readable sensor signals. The sensor signals are also alternatelyadjusted by incrementally changing the sensor offset current to adjusteach sensor signal peak value so that it is approximately equal to apredetermined nominal earth field value. The predetermined nominal earthfield value is selected for each sensor to be that which corresponds tothe nominal earth field which is to be encountered. Once the sensorsignal peak values are adjusted to the nominal level, so that they arereadable by the A/D, by the sensor offset current adjustment, a signalreference compensating value for each axis is determined using themaximum and minimum signal peak values as each peak is acquired for eachaxis. The signal reference value for each of the X-axis and Y-axissensors is stored when it is determined.

[0069] The normal calibration mode is operative during normal compassoperation, i.e. when the compass is being used in its operational modefor directional or heading information. During normal operation, sincethe sensors have already been adjusted to a nominal earth field valueand the compensating signal reference values determined, thecompensating signal reference values are adjusted for each axis by afixed step size, preferably two counts, as each new peak is determinedon the opposite or orthogonal axis. An axis can be calibrated upon theoccurrence of every new peak. During normal compensation, thecompensating signal reference values for each axis may be adjusted once,and preferably, twice, once for each new peak in the opposite axisduring each ignition or power-up cycle of compass operation.

[0070] A complete description of the initial calibration mode and thenormal operation calibration mode will be given below.

[0071] Electronic Circuit

[0072] Since certain portions of the electronic circuit of the SecondEmbodiment correspond to the First Embodiment described above, only abrief description will be given.

[0073] The compass electronic circuit, as shown in FIGS. 12A and 12B,comprises a microcomputer 38′ with support circuitry, a single slope A/Dconverter 42′, an offset circuit 50′ including an eight bit D/Aconverter 44′ driving a constant current source 48′, an EEPROM 46′, atwo-axis magnetoresistive (MR) sensor 32′, sensor bias circuitry 60′,and amplifier circuitry 70Y′ and 70X′ with a multiplexer 52′. Themicrocomputer 381 is an eight bit COP881C microcomputer available fromNational SemiConductor, Inc., and is provided with a reset circuit 72′coupled with the V_(cc),Reset and Ground pins, and a clock circuit 741connected with the pins CKI and CKO. The microcomputer 38′ is coupled tothe non-volatile EEPROM memory 46′ for data storage. A compass headingdisplay 76′, such as a vacuum fluorescent display, is also be coupled tothe microcomputer 38′. The heading may be presented in alphanumericformat to display the octant (cardinal and intercardinal) compassheadings to the vehicle operator. A calibrate switch 82 and a zoneswitch 84 described herein are also coupled with the microcomputer 38′in a switching circuit 80. The sensor set/reset driver circuit 60′comprises a pair of Darlington transistors Q2 and Q3 which are switchedalternately between conductive and non-conductive states by amicrocomputer switching signal, and are used to bias the MR sensors, asis described below.

[0074] The two-axis sensor 32′ includes two magnetoresistive (MR)sensors 10 and 10′ (see FIG. 4) for determining the X (east/west) and Y(north/south) components of a sensed magnetic field. Each of the MRsensors has a bias strap 16 and a current strap 18 as previouslydescribed with reference to FIGS. 1 and 4. The bias strap 16 is used toapply a set/reset signal to bias the MR sensor in two states. Since theMR sensors are biased in two states, the A/D converter 42′, which is atwelve bit converter, only has to read positive data. The readable A/Drange is set to be slightly greater than the, maximum earth field ofabout 300 Mgauss. Only about 3,000 steps (i.e., 3,000 mv) of the twelvebit A/D are used as the readable A/D range. The current strap is used toadjust the MR sensor output signals to a nominal earth field levelwithin the readable A/D range.

[0075] The X and Y sensor output signals are coupled through first andsecond stage amplifiers 302 and 304 to the inputs of the multiplexer52′, and thence the amplified X and Y outputs are coupled to a sharedsecond stage amplifier 306 (having temperature compensation). Themultiplexed X and Y sensor signals are then coupled through the sharedA/D converter 42′ to the microcomputer 38′. The microcomputer 38′determines whether either of the X and Y sensor signals are outside thereadable A/D range. If so, the signal is repeatedly increased ordecreased by changing the value on the D/A converter 44′ until thesensor signal is within the readable range. If either the X or Y sensorsignals is then not equal to the nominal earth field, the microcomputerdetermines the number of counts (steps) to apply to the D/A converter44′ to decrease or increase the current supplied to the current straps18 for each of the MR sensors so as to adjust the MR sensor signals to anominal earth field level within the readable A/D range. The nominalearth field level may, for example, be about 200 Mgauss.

[0076] The compass is provided with a manually actuated calibrate switch82 and a manually actuated zone switch 84. The calibrate switch is usedto enter the initial calibration mode by pressing and holding thecalibrate button for a predetermined time, say about a half second. Onceactivated, the legend “CAL” is displayed on display 76′ adjacent thelocation for display of the true vehicle heading to confirm to theoperator that the calibrate switch actuation has put the compass in theinitial calibration mode. The operator may then drive the vehicle in asuitable course to acquire sufficient peak (e.g., north) and peak set(e.g., north/south or east/west) information so that the microcomputer38′ can update the calibration data as each peak set (for thenorth/south or east/west axis) is acquired. After the vehicle has beendriven in such a course, for example through the approximately twocircles, the microcomputer will have counted six peaks (e.g., north orsouth). When a predetermined initial calibration criteria has been met,as described below, the compass will then automatically exit the initialcalibration mode and “CAL” is no longer displayed.

[0077] The initial calibration mentioned above is further described, asfollows. If the measured Y-axis sensor signal is out of the twelve bitA/D range (using about 3000 steps), then the Y-axis sensor signal isrepeatedly increased or decreased by changing the value on the D/A 44′until the Y-axis sensor signal is within the readable A/D range. If theY-axis sensor signal is not equal to the nominal earth field level, thenthe Y-axis sensor signal is again level shifted using the D/A 44′ untilit is equal to the nominal earth field. When a north/south peak set forthe Y-axis is obtained, the compensating signal reference value tocorrect the readable sensor signal is determined by averaging the northand south peak values. The above steps are repeated for the X-axis, sothat the X-axis sensor signal is adjusted to the nominal earth fieldlevel, and then the compensating signal reference value is determined byaveraging the east and west peaks. Finally, the compass determines ascaling factor for the axis having the lower maximum output signal toaccount for any output variances between the X-axis and Y-axis sensors.This completes the initial calibration mode.

[0078] The normal calibration mode is always operative whenever thecompass is being operated in its direction indicating mode. For normalcalibration, since the MR sensors have already been adjusted to anominal earth field level and the initial compensating signal referencevalues determined, the compensating signal reference values areautomatically adjusted or updated for each axis whenever a new peak isdetermined for the opposite or orthogonal axis. As the vehicle is beingdriven during normal compass operation, the X-axis and Y-axis sensordata are sampled and stored. When a Y-axis peak (e.g., north or south)is obtained, the opposing X-axis (east/west) signal reference value maybe adjusted or updated since a Y-axis peak should correspond to thereference value on the X-axis. Thus, the north/south or east/west axisis compensated whenever a new peak is obtained for its opposing axis.This may be done once for each peak such that each axis may be adjustedor compensated twice during any ignition or power-up cycle.

[0079] The zone switch 84 is used to compensate for the angulardifference between magnetic and true north. There are fifteen zones(zones 1 to 15), eleven of which cover the United States. The compassprovides zones which vary about +28 degrees from a center zone (zone 8).Within the United States, the variation from the center zone ranges fromabout −12 degrees to +28 degrees (zones 1 to 11). The zone entry mode isentered by actuating and holding the zone switch 84 until the currentzone setting appears in the display. The display may then be cycledthrough zones 1 to 15 by repeatedly actuating the zone switch 84. Whenthe desired zone is displayed, releasing the zone switch 84 will exitthe zone entry mode and store the new zone setting in non-volatilememory.

[0080] To filter the MR sensor data, the compass is provided with asoftware filter in the form of a digital lag filter which will bedescribed later. Additionally, to prevent the compass display fromoscillating between two octants, such as “IN” and “NE”, the display istime dampened so that a new heading will not be displayed until the sameheading data persists for about 1½ seconds. The display dampingtechnique of the present embodiment will be described later.

[0081] An alternate electronic circuit is shown in FIG. 13. This circuitincorporates much of the support circuitry into anapplication-specification integrated circuit (ASIC). The drawing of FIG.13 is self-explanatory.

[0082] Operation of the Second Embodiment

[0083] The operation of the second embodiment will now be described withreference to FIGS. 14 through 18. For convenience of explanation andunderstanding, the main loop of the control program will be describedfirst with reference to FIGS. 14A and 14B. The initial calibration modeis depicted as a routine in the flow charts of FIGS. 15A and 15B. Thenormal calibration mode is depicted in the flow chart of FIG. 16.Additionally, a sensor offset voltage calculation is explained withreference to FIG. 17 and is shown in the flow chart of FIG. 18.

[0084] Main Loop Operation

[0085] Referring now to FIGS. 14A and 14B, the compass operation will bedescribed with reference to the main loop of the control program of themicrocomputer 38′. The program starts at the start block 400. Themicrocomputer is reset at block 402 when the ignition switch is turnedon and the microcomputer is initialized for execution of the controlprogram. The microcomputer will interpret any user inputs, as describedherein, in block 403. The program advances to the retrieve data block404 which causes the microcomputer to read the Y-axis and X-axis signalsalternately at the output of the A/D converter 42′. A sub-routine forcalculating the sensor offset voltage is incorporated in the retrievedata block 404 and will be described below with reference to FIG. 18.The program advances to the test block 406 which determines whether thedata was ready for retrieval. If not, the program loops back to block403 as indicated. If data was ready for retrieval, the program advancesto a test block 408 which determines whether the new signal data isoutside the readable range of the A/D converter 42′. If it is, theprogram advances to block 410. If the compass is in the initialcalibration mode, this causes an eight count change in the D/A converter44′ setting to change the offset current through the current strap 18 ofthe corresponding Y-axis sensor or X-axis sensor to adjust the sensorsignal such that it is within the readable range of the A/D converter.If the compass is in the normal operating mode, there is no operation inblock 410. Next, the program loops back to block 403.

[0086] If at test block 408, the sensor signal is not readable by theA/D converter 42′, the program advances to block 412 which filters thedata, suitably by a digital lag filter, for the purpose of reducingnoise in the sensor signal. In the embodiment as described, a digitallag filter having the form

X_(F)(t)=X_(F)(t-1)+K * (X_(u)(t)−X_(F)(t-1) ),

[0087] where X_(F)(t) is the filtered value at time (t), X_(F)(t-1) isthe filtered value-at time (t-1), X_(u)(t) is the unfiltered value attime (t), and if the compass is in initial calibration mode,$\frac{1}{3 + {\left( {{X_{u}(t)} - {X_{F}\left( {t - 1} \right)}} \right)^{2}/8190}}$

[0088] or if the compass is in the normal operating mode,$\frac{1}{3 + {\left( {{X_{u}(t)} - {X_{F}\left( {t - 1} \right)}} \right)^{2}/4096}}$

[0089] Then, the program advances to block 414 which compensates thecompass for deviation resulting from the vehicle magnetic field. Block414 represents a sub-routine which is depicted in the flow charts ofFIGS. 15A, 15B and 15C which will be described in detail subsequently.

[0090] From block 414, the program advances to the test block 416 whichdetermines whether the deviation compensation procedure of block 414changed the output of the D/A converter 44′ and hence the offset currentin the current strap 18 of the sensor. If it did, the program loops backto block 403. If it did not, the program advances to block 418 whichscales the data for the Y-axis or X-axis signal having the lower maximumoutput by applying a scaling factor to account for the difference inmagnitude between the peak values of the X-axis and Y-axis signals. Atblock 420, new signal data is stored by copying data from the workingregisters to assigned locations in the random access memory (RAM) of themicrocomputer 38′. Then, the program advances to block 422 which causesthe microcomputer to detect the peak values of the signal data for eachaxis as they occur by examining the signal trend on each axis and todetect the difference between the signal reference value and the actualsignal value of the opposite axis to determine the sign of the two countreference adjustment. The peak value and signal reference adjustmentvalue for each axis are then stored in RAM as they are determined. Next,the program proceeds to block 424 which causes the microcomputer todetermine the heading angle of the vehicle by using a known functionalrelationship wherein the heading angle is expressed as an arctangentfunction of the X-axis and Y-axis signals. In block 426 the headingangle, expressed in units of degrees, is stored in the RAM.

[0091] After the heading angle is stored by block 426, the programadvances to the test block 428 which determines whether the compass isin the zone-setting mode. If it is, the program advances to block 403which interprets the user input to control the display in accordancewith such input. This permits the operator to select the geographicalzone and the corresponding variation angle to compensate for themagnetic variation angle of the earth field from true north whichdepends upon the geographical location of the vehicle. If block 428determines that the compass is not in the zone-setting mode, the programadvances to block 432 which adds the variation compensation angle to themagnetic heading which was stored by block 426. This allows themicrocomputer to develop an output signal which corresponds to the trueheading of the vehicle. The program then advances to block 434 whichupdates the true heading signal which is stored in the display memory.This block also converts the heading, as expressed in degrees, to aheading angle expressed in one of the eight principal compass points,i.e. the cardinal and intercardinal points. Changes in the compassdisplay are dampened using a four level progressive damping technique.Each level utilizes a progressively larger time duration. Typical timedurations for each level, one through four, are 1.3 seconds, 1.8seconds, 2.2 seconds, and 2.8 seconds, respectively. The damping levelused for a display update corresponds to the number of octants by whichthe new display differs from the existing display. From block 434, theprogram loops back to block 403.

Initial Calibration Mode of Deviation Compensation

[0092] The operation of the system in the initial calibration mode willnow be described with reference to FIGS. 15A and 15B. As discussedabove, in the initial calibration mode, the sensor offset current isfirst changed as needed to produce readable sensor signals which arewithin a predetermined measurement range. The signal peak values arealso adjusted to a nominal earth field level by changing the sensoroffset current. The compensating signal reference values are thendetermined for each axis, as the peak set values are determined, for therespective axis.

[0093] To enter the initial calibration mode, the calibrate switch 82 isactuated by the operator by pressing and holding it closed for apredetermined time, for example, about a half second. This causes thedisplay to display “CAL” to confirm to the operator that the compass isin the initial calibration mode. The operator may then calibrate thecompass by driving the vehicle in approximately two circles. As thevehicle traverses such a course, it acquires peak (e.g. north) and peakset (e.g. north/south or east/west) values. The microcomputer 38′ thendetermines the compensating signal reference value for each axis as eachpeak for that axis is determined. After the vehicle has been driven intwo circles, the microcomputer will have counted six peaks (e.g. northor south) and, provided the second and sixth correspond directionally(e.g., north and south) it will then automatically exit the initialcalibration mode and the “CAL” display is turned off.

[0094] The control program for performing deviation compensation (whichis represented by the block 414 in FIG. 14A ) will be described in moredetail with reference to FIGS. 15A and 15B. The compensation routinestarts with a test block 436 which determines whether the compass is inthe initial calibration mode. If it is not, the program proceeds tooperate in the normal calibration mode 480 which will be describedsubsequently with reference to FIG. 16. If the compass is in the initialcalibration mode, the program advances to the routine for that modeindicated at block 438. First, block 440 sets the time delay value tozero for the compass display. This disables the time delay which is usedin normal compass operation to dampen changes in the displayed directionwhen only a momentary change has occurred.

[0095] Then, the program advances to the test block 442 which determineswhether a peak set has occurred in the current axis. (In this routine,the program is executed alternately for the X-axis and Y-axis signals.In the flow chart, the term “current” axis means the axis for which theprogram is being executed at the time.) If there has not been a peak setin the current axis, the program advances to a test block 444 whichdetermines whether a peak has been validated in the current axis. Ifnot, the test block 446 determines whether the signal is out of peakdetection range. If it is, the microcomputer 38′ adjusts the D/Aconverter 44′ setting by eight counts to change the offset current inthe current strap 18 so that the sensor signal is adjusted such that itis within the readable A/D range enough to permit peak detection. Thisis done at block 448. Then, the program returns to the main loop for newdata.

[0096] If at block 444, it is determined that a peak has been validatedin the current axis, the program branches to test block 452. Thisdetermines whether the first peak has been. adjusted to the nominalearth field level. If it has not, the program advances to block 454which adjusts the offset current for the sensor so that the peak is at anominal level. (The nominal level, as stated above, is a signalcorresponding to an earth field of about 200 mGauss.) Then, block 456resets the peak, peak detect and average values and the program returnsto the main loop for new data at block 450.

[0097] If it is determined at test block 452 that the first peak hadbeen adjusted to a nominal level, the program advances to test block 453for a determination of whether the second and sixth peaks have bothoccurred. If not, at block 460 the program returns to the main loop atblock 416 to process the heading. If both peaks have occurred, testblock 458 determines whether they correspond directionally. If not,block 455 re-starts initial calibration and the program returns at block457 to the main loop for new data. If both peaks corresponddirectionally, the initial calibration exit criteria has been met andthe calibration flag is set at block 462. Then, the calibration counteris incremented at block 464 to keep track of the number of times thecompass has been calibrated. Next, the program advances to block 466which stores the calibration values in the non-volatile memory. Thisincludes the values on the D/A converter 44′, the scaling factor, thecompensating signal reference values, the peak values and the value ofthe register that stores the calibration flag. Then, the programadvances to block 468 which reloads the compass operating constants.This step includes reloading the EEPROM and storing the calibrationvalues in their respective storage locations including the calibrationstep-size (typically two counts) for normal calibration. Then, theprogram returns to the main loop for new data as indicated at block 470.

[0098] If at test block 442, it is determined that there has been a peakset in the current axis, the program advances to test block 472 whichdetermines whether there is a new valid peak in the current axis. If theanswer is no, the program proceeds to block 453 which was describedabove. If there is a new valid peak, the program advances to block 474to determine the signal reference value by calculating the average ofthe peak set values. Then, the program advances to block 476 whichcalculates the scaling factor. The scaling factor is used to match theoutput of one of the X-axis and Y-axis sensors to the other and for thispurpose, the signal from that axis which has the lower signal level ismultiplied by the scaling factor to scale it to the sensor having thelarger signal level. The scaling factor is calculated by dividing thepeak value of the larger signal by the peak value of the lower signal.After block 476, the program returns to the main loop for new data asindicated at block 478.

[0099] Normal compensation Mode

[0100] It is desirable to provide the compass with long term calibrationafter the initial calibration in order to compensate for any changesthat may occur on a long term basis in the ambient magnetic field. Forthis purpose, normal calibration is automatically performed whenever thecompass is operated in its direction indicating mode. The compassoperates in this mode at any time that the ignition switch is on and theinitial calibration mode is not operative. In general, in the normalcalibration mode, the X-axis and Y-axis sensor signals are sampled andstored. Whenever a new peak is acquired for one axis, which should occurat the signal reference value in the orthogonal axis, an adjustmentvalue is stored and later used to adjust the compensating signalreference value. This is accomplished by adding the stored signalreference adjustment to the existing signal reference value. Duringnormal compensation, the compensating signal reference values for eachaxis may be adjusted once, and preferably, twice, once for each new peakin the opposite axis during each ignition or power-up cycle of compassoperation. Suitably, this compensation is effected upon the occurrenceof the first peak in each of the X-axis and Y-axis after a warm-up delayas described below.

[0101] The operation in the normal calibration mode will be furtherdescribed with reference to the flow chart of FIG. 16. The normalcalibration mode is entered at block 480 and the test block 482determines whether the peak and signal reference adjustment informationis ready. If not, the program continues processing the data signals asindicated at block 496. If peak and signal reference adjustmentinformation is ready, the program advances to block 484 which determineswhether the power-up timer of the microcomputer 38′ is greater than fiveminutes which has the effect of delaying normal calibration for a periodof five minutes after the ignition switch is turned on. If the answer atblock 484 is no, the program advances to block 494 which resets thevalid peak flags and then the program continues data processing. If thetimer is greater than five minutes, the program advances to test block486 which determines whether the peak information that has been acquiredhas been used already in this power-up cycle. If it has, the programadvances to reset the valid peak flags at block 494 and data processingis continued. If the peak information has not yet been used, the programadvances to block 488 which sets a flag to indicate that this peak hasbeen used in this power-up cycle. Then, at block 490, the signalreference adjustment value is added to the compensating signal referencevalue. For example, in the case of an X-axis peak, if the Y-axismeasured signal at the time of the X-axis peak is not equal to theY-axis signal reference value, the signal reference value is adjusted bytwo counts towards the Y-axis measured value. Then, the program advancesto block 492 which stores the compensating signal reference values, i.e.the new reference value for each of the axes. In block 494, the validpeak flags are reset and the program then continues data processing asindicated in block 496.

[0102] Sensor Offset Calculation

[0103] Each of the X-axis and Y-axis sensors may have a signal offsetvoltage which is inherent in the system which, without proper correctionmay result in inaccurate or unusable sensor signals. The sensor offsetvoltage may arise in part from the internal characteristics of theparticular sensor. Further, the sensor offset voltage may be induced, inpart, from the signal path externally of the sensor and from softwarelatency. The sensor offset voltage is independent of the offset arisingfrom the vehicle magnetic field previously discussed.

[0104] Examples of sensor offset voltage are illustrated in FIG. 17.FIG. 17 is a graphical representation of the signal voltage of theY-axis sensor as a function of time as it is developed at the output ofthe A/D converter 42′. Lines C and D represent a signal with no offset.The line C represents the signal voltage developed during the reset modeand the line D represents the signal voltage developed during the setmode. Line C, being from the reset mode, is indicative of the magneticsouth component and line D, being from the set mode, is indicative ofthe magnetic north component. Lines C and D intersect at the referencevalue of the signal voltage which indicates the heading of east or west.

[0105] A signal with zero sensor offset voltage indicates a definitedirection without ambiguity. The sensor does not have an output signalin both set and reset modes at the same time. There are certainconditions of sensor offset voltage in which the signals, during resetand set modes are of such values that accurate direction information maynot be derived from them. One example of this condition is representedby a reset voltage corresponding to line E and a set voltagecorresponding to line F. In this condition, the Y-axis sensor has a zerooutput voltage in both sensor modes. In the time interval between thezero values, no direction information can be derived. Another example isa condition in which the sensor has a positive signal in both sensormodes at the same time. This is represented by reset voltage shown byline A and a set voltage shown by line B. In order to remove such offsetconditions, an offset voltage calibration value is calculated and addedto the sensor signal to compensate for the offset. This offsetcalibration value is calculated as one-fourth the sum of the set dataand reset data plus one-half of the previously calculated offset value.

[0106] The sensor offset voltage calculation routine is imbedded in theretrieve data block 404 of FIG. 14A. This routine 404′ entitled “SENSOROFFSET VOLTAGE CALIBRATION” is represented by the flow chart of FIG. 18.In this program, the set and reset mode data is retrieved from thecurrent axis at block 510. Then, at test block 512, it is determinedwhether both the set and reset data are greater than zero at the sametime or whether they are equal to zero at the same time. If they arenot, the program continues data processing as indicated at block 516. Ifthey are in block 514, the sensor offset calibration value is calculatedby adding one-fourth of the set data plus the reset data to one-half ofthe old calibration offset value.

[0107] As described, the sensor offset calibration value for each X-axisand Y-axis is used to compensate for the sensor offset in the programstep indicated at block 404. Accordingly, the signal data which isprocessed downstream of that block is corrected for sensor offset.

[0108] Compass And Vehicle Mirror Combination

[0109] According to this invention, the electronic compass isincorporated, in whole or in part, into the structure of a vehicleinside rearview mirror. In this application, the sensor board 36 (seeFIG. 4) may be mounted on the inside rearview mirror assembly so thatits position is fixed with respect to the vehicle or at a suitableremote location in the vehicle. The compass display .76′ may be locatedin the mirror structure for convenient viewing by the vehicle driver.Several different arrangements will be described below.

[0110] As shown in FIG. 19, the compass circuit of FIGS. 12A and 12B islocated in a compass module 230 secured below the mounting bracket 232of the rearview mirror 234.

[0111] As shown in FIG. 20, the module may communicate with a prismaticmirror or electrochromic mirror so that the vehicle heading may bedisplayed above the mirror. Alternatively, as shown in FIG. 21, thedisplay 76′ may be located behind the mirror and viewable through atransparent area by all passengers in the vehicle.

[0112]FIGS. 22A and 22B depict an integrated compass module. In thisarrangement, the compass module 230A houses the electronic circuit ofthe compass (either that of FIGS. 12A and 12B or that of FIG. 13) andalso the display. This module is supported on the mirror mountingbracket 232 such that the display 76′ is viewable below the mirror 234.

[0113] A stand alone compass module may be mounted similarly and supplydirectional information to other vehicle systems for display ornavigational purposes.

CONCLUSION

[0114] Although the description of this invention has been given withreference to particular embodiments, it is not to be construed in alimiting sense. Many variations and modifications will now occur tothose skilled in the art. For a definition of the invention, referenceis made to the appended claims.

What is claimed is:
 1. A method for compensating for the effect of adeviating magnetic field in a vehicle compass, said compass comprising:first and second magnetoresistive sensors responsive to an externalmagnetic field for developing electronic signals representative of saidexternal magnetic field, said external magnetic field being acombination of the earth magnetic field and a deviating field of thevehicle, said first and second sensors being oriented in a predeterminedangular relation with each other, and being aligned in a predeterminedangular relation with respective axes of said vehicle, each of saidsensors including means for nullifying at least part of a deviatingmagnetic field which impinges on it, said method comprising the stepsof: determining-whether the value of the sensor signal of each sensor isdifferent from a nominal value which corresponds approximately to thevalue of the earth magnetic field, if it is, using said nullifying meansfor adjusting the magnetic field impinging on each sensor to adjust thesensor signal to a value approximately equal to the nominal value,determining the maximum and minimum peak values of each sensor signal,determining the average of said peak values of each sensor signal, andmathematically compensating the actual value of each sensor signal inaccordance with the respective average value.
 2. A method forcompensating for the effect of a deviating magnetic field in a vehiclecompass, said compass comprising: first and second magnetoresistivesensors responsive to an external magnetic field for developingelectronic signals representative of said external magnetic field, saidexternal magnetic field being a combination of the earth magnetic fieldand a deviating field of the vehicle, said first -and second sensorsbeing oriented in a predetermined angular relation with each other, andbeing aligned in a predetermined angular relation with respective axesof said vehicle, each of said sensors including means for nullifying atleast part of a deviating magnetic field which impinges on it, a digitalelectronic circuit including means for measuring said signals when saidsignals are within a predetermined measurement range, said methodcomprising the steps of: determining whether the value of the sensorsignal of each sensor is within said measurement range, if it is not,using said nullifying means for nullifying at least part of magneticfield impinging on said sensor to reduce the sensor signal to a valuewithin said range.
 3. A method as defined in claim 2 including the stepsof: determining whether the value of the sensor signal of each sensor isgreater than a nominal value which is approximately equal to the earthmagnetic field, and if it is, using said nullifying means for adjustingat least part of the magnetic field impinging on each sensor to adjustthe sensor signal to a value approximately equal to the nominal value.4. A method as defined in claim 3 including the steps of: determiningthe maximum and minimum peak values of each sensor signal, determining areference value for each sensor signal equal to the average of said peakvalues of each sensor signal, and mathematically compensating the actualvalue of each sensor signal in accordance with the respective referencevalue.
 5. A method for updating the deviation compensation of a vehiclecompass comprising: first and second sensors responsive to an externalmagnetic field for developing electronic signals representative of saidexternal magnetic field, said external magnetic field being acombination of the earth magnetic field and a deviating field of thevehicle, said first and second sensors being oriented in a predeterminedangular relation with each other, and being aligned in a predeterminedangular relation with respective axes of said vehicle, and a memorywhich stores a reference value for each sensor signal, said referencevalue for each sensor being equal to an offset value for providingdeviation compensation for the respective sensor at a previous time,said method comprising the steps of: detecting the occurrence of a peakin the sensor signal of one of the sensors, measuring the value of thesensor signal of the other sensor which occurs at the same time as theoccurrence of said peak, and if there is a difference between themeasured value and said reference value, adjusting the reference valuein accordance with the difference.
 6. A method as defined in claim 5wherein said sensors are magnetoresistive sensors.
 7. A method asdefined in claim 5 wherein said compass is installed in a vehicle havinga switch which is in one of two switch states when the vehicle is beingdriven; and wherein said step of adjusting is executed a predeterminednumber of times during a time-interval that said switch is in said onestate without being switched to another state.
 8. A method ofdetermining an offset calibration value for a magnetoresistive sensor ina magnetic compass, said compass including an electronic circuit and amicrocomputer for processing an output signal from said sensor, saidsensor being alternately biased between a reset mode and a set mode,said method comprising the steps of: determining whether both resetsignal and the set signal are equal to or greater than zero at the sametime, if they are, calculate a sensor offset calibration value.
 9. Amethod as defined in claim 8 wherein said step of calculating includesadding one-fourth of set signal value plus the reset signal value toone-half of a previous sensor offset calibration value which wascalculated in the same way the last time the calibration value wascalculated.
 10. A method for compensating an electronic compass in avehicle of the type comprising first and second sensors oriented in apredetermined angular relation with each other and with respective axesof the vehicle, said method comprising the steps of: determining acompensating reference signal value for each sensor, detecting theoccurrence of a peak in the sensor signal of one of the sensors,measuring the value of the sensor signal of the other sensor whichoccurs at the same time as the occurrence of said peaks, and, if thereis a difference between the measured value and the reference value,adjusting the reference value in accordance with the difference.
 11. Incombination, for use in a vehicle, an electronic compass comprising amagnetoresistive sensor for detecting the magnetic field of the earth,an electronic circuit coupled with said sensor for developing signalsindicative of the direction of said vehicle, and electronic displaycoupled with said circuit for displaying said direction, a rear viewmirror, said electronic display being disposed on said mirror forviewing by a driver of said vehicle.
 12. The invention as defined byclaim 11 wherein said sensor and said electronic circuit are mounted onsaid mirror.